<script setup lang='ts'>
  import { onMounted, reactive } from 'vue';
  import { luckDrawApi } from '@/api/controller';
  import { Toastloading } from '@/utils/public';
  import { getDateArray, getPlayEndTime } from '@/utils'
  import xmDatePicker from '@/components/xmDatePicker/index.vue';
  const action = reactive({
    list:[] as any[],
    timeObj:getPlayEndTime(getDateArray('ymdhis'))
  })
  const listQuery = reactive({
    luck_id:'',
  })
  const getList = async()=> {
    const loading = Toastloading()
    const { playTime, endTime } = action.timeObj
    const res = await luckDrawApi.awardStatisticsListdefender({
      created_st:playTime,
      created_ed:endTime,
      luck_id:listQuery.luck_id
    })
    loading.close()
    const { data=[] } = res
    action.list = data
  }
  onMounted(()=>{
    getList()
  })
</script>

<template>
  <div class="xm-content">
    <div class="xm-headTab">
      <div class="labelBox">
        <div class="labelItem">
          <div class="label">活动ID：</div>
          <el-input v-model="listQuery.luck_id" placeholder="请输入活动ID" />
        </div>
        <xmDatePicker v-model:timeval="action.timeObj" />
        <div class="labelItem">
          <el-button type="primary" @click="getList">查询</el-button>
        </div>
      </div>
    </div>
    <el-table
      class="xm-main xm-TableCenter"
      :data="action.list"
      border
    >
      <el-table-column width="120" prop="luck_id" label="活动ID" />
      <el-table-column min-width="150" prop="luckName" label="活动名称" />
      <el-table-column min-width="120" prop="gift_id" label="礼物ID" />
      <el-table-column min-width="120" prop="giftName" label="礼物名称" />
      <el-table-column min-width="120" prop="giftNum" label="礼物数量" />
      <el-table-column min-width="120" prop="totalPirce" label="礼物总价值" />
    </el-table>
  </div>
</template>
